<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/view/common/includes.jsp" %>
<%@ include file="/WEB-INF/view/inc.jsp" %>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<script type="text/javascript">
    var grid;
    $(function () {
        grid = $('#grid').datagrid({
            onSelect: function (index, row) {
                if (row != undefined) {
                    $('#grid2').datagrid({
                        queryParams: {
                            codeCategoryId: row.id
                        }
                    });
                    $('#grid2').datagrid('clearSelections');
                    $('#grid2').datagrid('clearChecked');
                }
            },
            onLoadSuccess: function (row, data) {
                if (row) {
                    $(this).datagrid("selectRow", 0);
                }
            }
        });
    });

    var addCodeItems = function () {
        var codeCategoryId = grid.datagrid("getSelected").id;
        if (!codeCategoryId && typeof(codeCategoryId) != "undefined" && codeCategoryId != 0) {
            parent.$.messager.alert('提示', "类别为空", 'error');
            return;
        }
        sy_addFun(sy.contextPath + '/sys/codeItems/toSaveAndUpdate/' + codeCategoryId + '/', '添加码表信息', '400', '500', $('#grid2'))
    }
</script>

<body>
<div class="easyui-layout" fit="true">
    <div data-options="region:'center',title:'代码类别'">
        <div class="easyui-layout" data-options="fit : true,border : false">
            <!-- 搜索框 -->
            <div data-options="region:'north',title:'查询条件',border:false" style="height:80px; overflow: hidden">
                <form id="searchForm">
                    <div class="fitem fl">
                        <label>名称:</label>
                        <input name="categoryName" class="easyui-textbox">
                        <label>代码:</label>
                        <input name="categoryCode" class="easyui-textbox">
                    </div>
                    <div class="fitem searchItem fr" style="margin-right: 30px;">
                        <a class="easyui-linkbutton" iconCls="icon-search" onclick="sy_searchFun()">搜索</a>
                        <a class="easyui-linkbutton" iconCls="icon-reload" onclick="sy_resetFun()">重置</a>
                    </div>
                </form>
            </div>
            <div data-options="region:'center',border:false">
                <table id="grid" class="easyui-datagrid" fit="true"
                       data-options="url: '<%=contextPath%>/sys/codeCategory/list',method: 'post',pagination: true,rownumbers:true,idField: 'id', fitColumns:true,singleSelect:true,sortName:'createTime',sortOrder:'desc',toolbar: '#toolbar'">
                    <thead>
                    <tr>
                        <th data-options="field:'categoryName'" width="100">类别名称</th>
                        <th data-options="field:'categoryCode'" width="100">类别代码</th>
                        <th data-options="field:'remark'" width="100">备注</th>
                        <th data-options="field:'status',dictionary:'status',formatter:sy_dict" width="100">状态</th>
                    </tr>
                    </thead>
                </table>
            </div>
        </div>
        <!-- 按钮-->
        <div id="toolbar" style="display: none;">
            <t:button action="codeCategory_add" iconCls="icon-add" buttonName="新增" onclick=""/>
            <t:button action="codeCategory_edit" iconCls="icon-edit" buttonName="编辑" onclick=""/>
            <t:button action="codeCategory_remove" iconCls="icon-remove" buttonName="删除" onclick=""/>
        </div>
    </div>
    <div data-options="region:'east',split:true,collapsed:true" title="类别列表" style="width:420px;">
        <table id="grid2" class="easyui-datagrid" fit="true"
               data-options="url: '<%=contextPath%>/sys/codeItems/list',method: 'post',pagination:true,rownumbers:true,idField: 'id', fitColumns:true,singleSelect:true,sortName:'sortIndex',sortOrder:'asc',toolbar: '#toolbar2'">
            <thead>
            <tr>
                <th data-options="field:'name'" width="220">列表名称</th>
                <th data-options="field:'code'" width="100">列表代码</th>
                <th data-options="field:'sortIndex'" width="100">排序</th>
                <%--<th data-options="field:'remark'" width="100">备注</th>--%>
                <th data-options="field:'status',dictionary:'status',formatter:sy_dict" width="100">状态</th>
            </tr>
            </thead>
        </table>
        <!-- 按钮-->
        <div id="toolbar2" style="display: none;">
            <t:button action="codeItems_add" iconCls="icon-add" buttonName="新增" onclick=""/>
            <t:button action="codeItems_edit" iconCls="icon-edit" buttonName="编辑" onclick=""/>
            <t:button action="codeItems_remove" iconCls="icon-remove" buttonName="删除" onclick=""/>
        </div>
    </div>

</div>
</div>
</body>
</html>



